<?php
defined('SYS_RUN') or exit();

class Sys {

    public static function run() {
        Lib::get('route')->to();
        Lib::get('gzip')->compressOutput();
    }

    public static function mergeArray($a,$b) {
        $args = func_get_args();
        $res = array_shift($args);
        while(!empty($args)) {
            $next = array_shift($args);
            foreach($next as $k => $v) {
                if(is_integer($k))
                    isset($res[$k]) ? $res[]=$v : $res[$k]=$v;
                elseif(is_array($v) && isset($res[$k]) && is_array($res[$k]))
                    $res[$k]=self::mergeArray($res[$k],$v);
                else
                    $res[$k]=$v;
            }
        }
        return $res;
    }

    public static function checkParentClass ($object, $parentClass) {
        $parentClass = trim($parentClass);
        $objectClass = get_parent_class($object);
        if ($objectClass != $parentClass){
            Error::trigger("Parent class is not valid: '".ucfirst($parentClass)."'");
            return false;
        }
        return true;
    }

    public static function isWindows() {
        if(PHP_OS == 'WINNT')
            return true;
        else return false;
    }
}